#include "qcheck.h"

QCheck::QCheck()
{

}

/* CRC32校验 */
quint32 QCheck::CRC32(const quint8 *pStart, int size)
{
	quint32 uCRCValue;
	const quint8 *pData;

	/* init the start value */
	uCRCValue = 0xffffffff;
	pData = pStart;

	/* calculate CRC */
	while(size--)
	{
		uCRCValue = CRC32_Table[(uCRCValue ^ *pData++) & 0xff] ^ (uCRCValue >> 8);
	}
	/* XOR the output value */
	return uCRCValue ^ 0xffffffff;
}
